<template lang="pug">
  router-link(to='/personal/membership_card/record').membership-card
    div.title {{card.mname}}
    div.content
        span 剩余：
            span.val ￥{{card.balance|priceFilter}}
        span 充值金额：
            span.val ￥{{card.amount|priceFilter}}
    div.time 购买时间：
        span.val {{card.createtime|dateFilter}}
</template>
<script>
import moment from "moment";
export default {
  props: ["card"],
  filters: {
    priceFilter(price) {
      return (price / 100).toFixed(2);
    },
    dateFilter(time) {
      return moment(time, 'X').format("YYYY-MM-DD");
    }
  }
};
</script>

<style lang="stylus" scoped>
.membership-card {
    display: block;
    background-color: #fff;
    padding: 0.3rem;
    font-size: 0.3rem;
    line-height: 0.5rem;

    .title {
        font-weight: bold;
    }

    span {
        &.val {
            color: #666;
        }
    }

    .content {
        >span {
            margin-right: 0.3rem;
        }
    }
}
</style>
